package com.xbongbong.saas.model;

import com.xbongbong.paas.domain.entity.ext.ConditionsEntityExt;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.pro.domain.entity.ScoreRangeEntity;
import com.xbongbong.pro.score.pojo.dto.ScoreRangeDetailDTO;
import com.xbongbong.pro.score.pojo.vo.ScoreRangeDetailVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author chunyang.qin
 * @Title: 评分显示区间实现类
 * @date 2020/11/27 14:58
 */
public interface ScoreRangeModel extends IModel<ScoreRangeEntity> {
    @Override
    Integer insert(ScoreRangeEntity entity) throws XbbException;

    @Override
    Integer update(ScoreRangeEntity entity) throws XbbException;

    @Override
    List<ScoreRangeEntity> findEntitys(Map<String, Object> param);

    @Override
    Integer getEntitysCount(Map<String, Object> param);

    ScoreRangeEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);
    ScoreRangeEntity getByFormId(@Param("formId") Long formId, @Param("corpid") String corpid);

    Integer deleteByKey(@Param("key") Long key, @Param("corpid") String corpid);

    /**
     * 获取该表单下的评分展示区间
     * @param
     * @return
     * @throws XbbException
     */
    ScoreRangeDetailVO getScoreRange(ScoreRangeDetailDTO scoreRangeDetailDTO) throws XbbException;

    /**
     * 获取评分展示的值
     * @return 评分的展示方式，没有命中的话展示 “-”。
     * Double score, ScoreRangeDetailVO scoreRangeDetailVO
     * PaasFormDataEntityExt
     */
    String getScoreShowValue(Integer businessType , PaasFormDataEntityExt paasFormDataEntityExt) throws XbbException;

    Boolean isRangWithScoreShowType(String corpid , Long formId) throws XbbException;

    void scoreCondition(String corpid, List<ConditionsEntityExt> conditions, Long formId) throws XbbException;

    void getScoreShowValueByList(Integer businessType, String corpid, Long formId, List<PaasFormDataEntityExt> dataList) throws XbbException;
}
